package thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by yl on 2019/10/11
 */
public class JstackCase {
    public static final ExecutorService executorService = Executors.newFixedThreadPool(3);
    public static final Object lock = new Object();

    public static void main(String[] args) {
        Task task1 = new Task();
        executorService.submit(task1);
        Task task2 = new Task();
        executorService.submit(task2);
    }
    static class Task implements Runnable{

        @Override
        public void run() {
            synchronized (lock){
                calculate();
            }
        }
        public void calculate(){
            int i = 0;
            while (true){
                i++;
            }
        }
    }
}
